package cn.edu.ctbu.datajpacrud.controller;
import cn.edu.ctbu.datajpacrud.domain.Teacher;
import cn.edu.ctbu.datajpacrud.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class TeacherController {
    @Autowired
    TeacherService teacherService;

    @RequestMapping("/teacher/list")
    public String list(Model model) {
        List<Teacher> teachers = teacherService.findAll();
        model.addAttribute("data", teachers);
        return "/teacher/list";
    }
}
